package D2;

import java.util.Random;

import java.util.Scanner;



public class Chouka {

    final static String[] sanxingwuqi = new String[] { "弹弓", "神射手之誓", "鸦羽弓", "翡玉法球", "讨龙英杰谭", "魔导绪论", "黑缨枪", "以理服人",

            "沐浴龙血的剑", "铁影阔剑", "飞天御剑", "黎明神剑", "冷刃" }; // 三星武器：13

    final static String[] sixingwuqi = new String[] { "弓藏", "祭礼弓", "绝弦", "西风猎弓", "昭心", "祭礼残章", "流浪乐章", "西风秘典", "西风长枪",

            "匣里灭辰", "雨裁", "祭礼大剑", "钟剑", "西风大剑", "匣里龙吟", "祭礼剑", "笛剑", "西风剑" }; // 四星武器：18

    final static String[] sixingjuese = new String[] { "辛焱", "砂糖", "迪奥娜", "重云", "诺艾尔", "班尼特", "菲谢尔", "凝光", "行秋", "北斗",

            "香菱", "安柏", "雷泽", "凯亚", "芭芭拉", "丽莎", "罗莎莉亚", "早柚", "九条裟罗" }; // 四星角色：19

    final static String[] wuxingjuese = new String[] { "霆霓快雨：刻晴", "星天水镜：莫娜", "冻冻回魂夜：七七", "晨曦的暗面：迪卢克", "蒲公英骑士：琴" }; // 五星角色：5

    final static String[] wuxingwuqi = new String[] { "弓  阿莫斯之弓", "弓  天空之翼", "法器  四风原典", "法器  天空之卷", "长枪  和璞鸢",

            "长枪  天空之脊", "双手剑  狼的末路", "双手剑  天空之傲", "单手剑  天空之刃", "单手剑  风鹰剑" }; // 五星武器：10

    static int WX[] = new int[100], t = 0, n = 0; // 记录数据

    static int chou = 0, x, baodi = 0, y, xiaobaodi = 0, dabaodi = 0;

    static int sixing = 0, wuxing = 0, sum = 0;



    public static void main(String[] args) {

        System.out.println("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");

        System.out.println("欢迎使用常驻池抽卡模拟器1.0" + "\n" + "模拟器概率公示:");

        System.out.println("5星基础：0.6%，5星角色：0.3%， 5星武器：0.3%");

        System.out.println("5星保底：1.6%，90抽5星保底");

        System.out.println("4星基础：5.1%，4星角色：2.55%，4星武器：2.55%");

        System.out.println("4星保底：13%，10抽4星以上保底，其中4星占99.4%，5星占0.6%");

        System.out.println("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*");

        Suijichou();



    }



    static void Suijichou() {

        do {

            menu();



            Scanner in = new Scanner(System.in);

            chou = in.nextInt();

            if (chou == 0)

                System.exit(0);

            else if (chou == -1)

                query();



            else

                for (int i = 0; i < chou; i++) {

                    xiaobaodi++;

                    dabaodi++;

                    sum++;

                    Random rand = new Random();

                    x = rand.nextInt(100000);

                    if (xiaobaodi >= 10) {

                        baodi = rand.nextInt(2);

                        if (baodi == 0) {

                            sixingrw();

                        } else if (baodi == 1) {

                            sixingwq();

                        }

                        xiaobaodi = 0;

                        sixing++;

                    } else if (dabaodi >= 90) {

                        baodi = rand.nextInt(2);

                        if (baodi == 0) {

                            wuxingrw();

                        } else if (baodi == 1) {

                            wuxingwq();

                        }

                        dabaodi = 0;

                        wuxing++;

                    } else if (x < 600) {

                        baodi = rand.nextInt(2);

                        if (baodi == 0) {

                            wuxingrw();

                        } else if (baodi == 1) {

                            wuxingwq();

                        }

                        dabaodi = 0;

                        wuxing++;

                    } else if (x < 5700) {

                        baodi = rand.nextInt(2);

                        if (baodi == 0) {

                            sixingrw();

                        } else if (baodi == 1) {

                            sixingwq();

                        }

                        sixing++;

                        xiaobaodi = 0;

                    } else {

                        sanxingwq();

                    }

                }

        } while (chou != 0);



    }



    static void menu() {

        System.out.println("***********************************************");

        if (sum > 0) {

            System.out.println("抽卡总数：" + sum + "\t" + "四星数量：" + sixing + "\t" + "五星数量：" + wuxing);

            if (wuxing > 0) {

                System.out.println("平均" + sum / wuxing + "抽一个金");

            }

        }

        System.out.println("请输入你抽卡的次数:(0退出,-1查询)");

        System.out.println("***********************************************");



    }



    static void query() {

        if (t > 0) {

            System.out.println("抽中的五星为：");

            for (int m = 0; m < t; m++) {

                if (WX[m] >= 100) {

                    y = WX[m] - 100;

                    System.out.print(wuxingwuqi[y] + "\t\t");

                    n++;

                } else {

                    y = WX[m] - 10;

                    System.out.print(wuxingjuese[y] + "\t\t");

                    n++;

                }

                if (n == 2) {

                    System.out.println();

                    n = 0;

                }

            }

        } else

            System.out.print("查询失败。");

        System.out.println();

    }



    static void sanxingwq() {

        Random rand = new Random();

        y = rand.nextInt(13);

        System.out.println("三星武器 *** " + sanxingwuqi[y]);



    }



    static void sixingwq() {

        Random rand = new Random();

        y = rand.nextInt(18);

        System.out.println("四星武器  ****  " + sixingwuqi[y]);



    }



    static void wuxingwq() {

        Random rand = new Random();

        y = rand.nextInt(10);

        System.out.println("\n" + "五星武器  *****   " + wuxingwuqi[y] + "\n");

        WX[t] = y + 100;

        t++;

    }



    static void sixingrw() {

        Random rand = new Random();

        y = rand.nextInt(19);

        System.out.println("四星角色 *****  " + sixingjuese[y]);



    }



    static void wuxingrw() {

        Random rand = new Random();

        y = rand.nextInt(5);

        System.out.println("\n" + "五星角色  *****   " + wuxingjuese[y] + "\n");

        WX[t] = y + 10;

        t++;

    }

}